package com.dynamo.transport.network.practise.channel;

/**
 * @author duanyimiao
 * @create 2018-11-18 6:27 AM
 * @description
 **/
public class SimpleChannelDownstreamHandler implements ChannelDownstreamHandler {
    @Override
    public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) {
        System.out.println("SimpleChannelDownstreamHandler handleDownstream");
        if(e instanceof MessageEvent){
            writeMsg(ctx,(MessageEvent)e);
        }else{
            ctx.sendDownstream(e);
        }
    }

    protected void writeMsg(ChannelHandlerContext ctx,MessageEvent e){
        ctx.sendDownstream(e);
    }
}
